package com.fegin.client.admin;

import com.fegin.Hystrix.admin.RoleFigenHystrix;
import com.fegin.bean.admin.AdminRole;

import com.fegin.bean.common.layuiBean.ResultPage;
import com.fegin.bean.common.layuiBean.VoPage;
import com.fegin.common.ServerNameConstant;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author 张子艺
 * @packge com.fegin.client
 * @data 2019-01-16 09:23
 * @project currencycloud
 */
//微服务名字                         熔断器
@FeignClient(value = ServerNameConstant.ADMIN_SERVER, fallbackFactory  = RoleFigenHystrix.class)
public interface RoleFegin {


    @RequestMapping(value = "/admin/role/findRoleByPage",
            method = RequestMethod.POST,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    ResultPage<AdminRole> findRoleByPage(@RequestBody VoPage voPage,@RequestParam("flag") int flag,@RequestParam("loginId")Long loginId);

    @RequestMapping(value = "/admin/role/insertRole",
            method = RequestMethod.POST,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    Map<String, Object> insertRole(@RequestParam("roleName") String roleName, @RequestParam("menuId") String menuId,@RequestParam("userId")  Long userId);

    @RequestMapping(value = "/admin/role/insertDistribution",
            method = RequestMethod.POST,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    Map<String, Object> insertDistribution(@RequestParam("roleName") String roleName, @RequestParam("menuId") String menuId , @RequestParam("userId") Long userId);


    @RequestMapping(value = "/admin/role/delRole",
            method = RequestMethod.POST,
            consumes = MediaType.APPLICATION_JSON_VALUE
    )
    Map<String, Object> delRole(@RequestParam("roleId") Long roleId);

    @RequestMapping(value = "/admin/role/findRoleAll",
            method = RequestMethod.GET
    )
    Map<String, Object> findRoleAll(@RequestParam("loginId")Long loginId,@RequestParam("flag")int flag);

}
